package com.ruiya.staging.goods.cas.controller;

import com.ruiya.staging.goods.cas.service.EchoService;
import org.apache.commons.lang3.tuple.Pair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

@RestController
public class EchoController {

    @Autowired
    private EchoService echoService;

    @GetMapping(value = "/echo")
    public Pair<Integer, String> echo(@RequestParam(defaultValue = "hello")String name){
        String tid = UUID.randomUUID().toString();
        String sharding = "123";

        Pair<Integer, String> result = echoService.echo(tid, sharding, name);
        return result;
    }

}
